<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<form:form commandName="model" cssClass="validate"
	action="slm/alarmSetting/save">
	<form:hidden path="id" />
	<form:hidden path="description" />
	<form:hidden path="distance" />
	<div class="header">
		<h2>
			&nbsp;&nbsp;提醒设置<span><font color="red">（* 为必填项）</font> </span>
		</h2>
	</div>
	<table class=" form-table">
		<tbody>
			<tr>
				<td class="td1">标题：</td>
				<td class="td2"><form:input path="title" maxlength="100" cssClass="required" /></td>
			</tr>
			<tr>
				<td class="td1">考核指标：</td>
				<td class="td2"><form:select path="serviceTargetId"
						items="${serviceTargets}" itemLabel="name" itemValue="id"
						cssClass="required" />
				</td>
			</tr>
			<tr>
				<td class="td1">发送时间设定：</td>
				<td class="td2"><form:radiobuttons path="type"
						items="${alarmSettingTypes}" cssClass="required" /> <input
					name="distinceHours" value="${distinceHours}" type="text"
					style="width:30px" maxlength="2" class="number" />小时<input
					name="distinceMinutes" value="${distinceMinutes}" type="text"
					style="width:30px" maxlength="2" class="number" />分 <label
					class="required"></label>
				</td>
			</tr>
			<tr>
				<td class="td1">发送方式：</td>
				<td class="td2"><form:checkboxes path="sendWay"
						items="${messageSendWays}" />
				</td>
			</tr>
			<tr style="display:none">
				<td class="td1">发送次数：</td>
				<td class="td2"><form:input path="sendTimes" cssClass="number"
						maxlength="2" />
				</td>
			</tr>
			<tr style="display:none">
				<td class="td1">发送间隔（分钟）：</td>
				<td class="td2"><form:input path="intevalMm" cssClass="number"
						maxlength="2" />
				</td>
			</tr>
			<tr>
				<td class="td1">发送内容：</td>
				<td class="td2"><form:textarea path="content"
						cssStyle="width:80% !important;min-height:120px;height:120px !important"
						maxlength="500" /> <isperp:entityVariable
						id="contententityVariable" targetControlId="content"
						tableName="${tableName }">
					</isperp:entityVariable></td>

			</tr>
		</tbody>
	</table>
</form:form>


<div class="grid_12" style="margin: 3px 0;width:100%">
	<div class="header">
		<h2 style="text-align: left">消息接收人员设定</h2>
	</div>
	<div id="nodeUserInfo">
		<isperp:grid url="slm/alarmObject/list?relationId=${model.id}"
			gridId="alarmObjectGrid" cusDialogSize="normal"
			cusFormatterActions="true" cusEditUrl="slm/alarmObject/edit"
			beforeCreateAction="'relationId=${model.id}'"
			cusDeleteUrl="slm/alarmObject/delete" showPager="false"
			showSearchbar="false" ondbClickRowEvent="alarmObjectGrid.edit(rowid);">
			<jsp:attribute name="toolbar">
			<isperp:toolbar>
			<button onclick="javascript: isperp.submitForm({success:function(){alarmObjectGrid.create();}})">添加消息接收人员</button>
			</isperp:toolbar>	
			</jsp:attribute>

			<jsp:body>
			<isperp:column name="id" title="id" hidden="true"></isperp:column>
			<isperp:column name="assignType" title="处理人类型" width="160"
					isFormatterFun="true"
					formatter="switch(cellvalue){ 
						case 0:return '提交人';
						case 1:return '特定角色';
						case 11:return '特定项目的角色';
						case 2:return '特定成员';
						case 3:return '表单内成员帐号';						
						case 4:return '特定部门下所有成员';
						case 5:return '任务处理人'; 
						default:return cellvalue;
						 }">
			</isperp:column>
			<isperp:column name="cmpNames" title="分配对象" width="200">
			</isperp:column>
			</jsp:body>
		</isperp:grid>
	</div>
</div>

<script type="text/javascript">
	isperp.setCheckbox("input[name='sendWay']", "${model.sendWay}");
</script>

<isperp:buttonList>
	<button class="submit" onclick="isperp.submitForm();">确认</button>
</isperp:buttonList>
